<template>
  <div class="padding-20">
    <div class="bg-white padding-top-30 padding-bottom-15 padding-left-right-20">
      <form-common :filed-list="addContractFiledList" ref="form" @selectChange="selectChange"></form-common>
    </div>

    <div class="bg-white padding-20 margin-top-20">
      <div class="padding-bottom-10 flex justify-between">
        <span class="font-weight-700 font-size-18">签约方</span>
        <el-button v-if="isEdit" class="normal-btn" size="mini" type="primary" @click="addTableItem('sign')">添加签约方</el-button>
      </div>

      <sign-table ref="signTable" :isEdit="isEdit" :contract-type="contractType" :table-list="signList" @deleteItem="deleteItem($event, 'sign')" @confirmAddItem="confirmAddItem($event, 'sign')"></sign-table>
    </div>

    <div class="bg-white padding-20 margin-top-20">
      <!-- 收入类合同 -->
      <template v-if="contractCategory == 1">
        <div class="padding-bottom-10 flex justify-between">
          <span class="font-weight-700 font-size-18">租赁信息</span>
          <el-button v-if="isEdit" class="normal-btn" size="mini" type="primary" @click="addTableItem('lease')">{{ addBtnTxt }}</el-button>
        </div>

        <info-table ref="infoTable" :isEdit="isEdit" :contract-type="contractType" :table-list="leaseList" :subsidy-type-list="subsidyTypeList" :paymentMethodList="paymentMethodList" @deleteItem="deleteItem($event, 'lease')"></info-table>
        <info-table-item ref="infoTableItem" :contract-type="contractType" :option-map="optionMap" :relevance-param="relevanceParam" :table-list="leaseList" @confirmAddItem="confirmAddItem($event, 'lease')"></info-table-item>
      </template>
      <!-- 支出类合同 -->
      <template v-else>
        <div class="padding-bottom-10 flex justify-between">
          <div class="flex align-center">
            <div v-if="contractCategory == 2" class="font-weight-700 font-size-18">支出信息</div>
            <div v-if="contractCategory == 2" class="font-size-16 padding-left-20">合同总金额：{{ payAllPrice | moneyFilterNoUnit }}元</div>
          </div>
          <el-button v-if="isEdit" class="normal-btn" size="mini" type="primary" @click="addTableItem('lease')">{{ addBtnTxt }}</el-button>
        </div>

        <info-pay-table ref="infoTable" :isEdit="isEdit" :contract-type="contractType" :table-list="leaseList" @deleteItem="deleteItem($event, 'lease')"></info-pay-table>
        <info-pay-table-item ref="infoTableItem" :contract-type="contractType" :option-map="optionMap" :relevance-param="relevanceParam" :table-list="leaseList" @confirmAddItem="confirmAddItem($event, 'lease')"></info-pay-table-item>
      </template>
    </div>

    <!-- 附件 -->
    <div class="bg-white padding-left-right-20 padding-top-20 margin-top-20">
      <div class="padding-bottom-10 flex justify-between">
        <span class="font-weight-700 font-size-18">附件</span>
      </div>

      <contract-file ref="file" :contract-info="contractInfo" :contract-type="contractType"></contract-file>
    </div>

    <!-- 合同账单 -->
    <div v-if="contractCategory == 1 && (!contractInfo.contractStatus || $route.query.isAgreement)" class="bg-white padding-20 margin-top-20">
      <div class="flex align-center justify-between">
        <div class="flex align-center">
          <span class="font-weight-700 font-size-18 margin-right-15">合同账单</span>
          <el-link type="primary" v-if="billAttachment.fileUrl" @click="uploadLoad(billAttachment.fileUrl)">{{ billAttachment.fileDesc }}</el-link>
        </div>
        <div class="flex">
          <el-button v-if="isEdit" class="normal-btn" size="mini" type="primary" @click="downBillTemplate">下载模板</el-button>
          <upload-file v-if="isEdit" class="margin-left-10" :disabled="leaseList.length > 0 ? false : true" isShowList="" :limit="100" filed-name="file" :buttonPlain="false" :max-size="100" accept-file-type=".xlsx,.xls,.csv,.png,.jpg,.Png,.Jpg,.docx,.pdf,.zip" @handleSuccess="handleSuccess($event)"> </upload-file>
        </div>
      </div>
    </div>

    <div class="padding-bottom-20 flex justify-center margin-top-20">
      <el-button v-if="isEdit" class="normal-btn" type="primary" @click="submit">保存</el-button>
      <el-button v-if="isEdit" class="normal-btn" type="primary" @click="submit('audit')">提交</el-button>
    </div>
  </div>
</template>

<script>
  //contractStatus: 0 草稿 1 审批中 2 审批完成/履行中 3 驳回 4 履行完毕 5 已废止
  import { apiPactConstant } from '@a/index';
  import { addContractFiledList } from './form';
  import formCommon from '@g/components/form/formCommon.vue';
  import infoTable from './components/addTable.vue';
  import infoTableItem from './components/addTableItem.vue';
  import infoPayTable from './components/addPayTable.vue';
  import infoPayTableItem from './components/addPayTableItem.vue';
  import signTable from './components/signTable.vue';
  import billTable from './components/billTable.vue';
  import contractFile from '../drafts/contractFile.vue';
  import { guid, requestTips, setFiledVal, askDialog } from '@/common/js/utils';
  import { listByMapBizId, apiProjectList, apiDictMoreList, categoryList, apiShopList, apiParkList, apiAdvertList, apiContractInfo, apiAreaList, apiEquipmentTree, apiFacilityTree, apiAnalysisFile, apiAnalysisDownload, apiAddContract, apiUpdateContract, apiContractBillBaseList } from '../../../api/contract';
  import { apiCreateAudit } from '../../../api/common';
  import merge from 'webpack-merge';
  import uploadFile from '../../projectInfo/modules/upload.vue';

  export default {
    name: 'add',
    data() {
      return {
        addContractFiledList: addContractFiledList,
        signDialogShow: false,
        contractType: this.$route.query.contractType,
        contractCategory: this.$route.query.contractCategory,
        subsidyTypeList: [], //补贴事项类型
        signList: [], //签约方
        paymentMethodList: [], //付款方式
        leaseList: [], //租赁信息
        billAttachment: {
          fileUrl: '',
          fileId: '',
          fileDesc: '',
        },
        billList: [], //账单信息
        billFileName: '',
        contractInfo: {},
        userInfo: JSON.parse(localStorage.getItem('userInfo')),
        enterpriseid: localStorage.getItem('userEnterpriseid'),
        relevanceParam: {},
        optionMap: {
          shopList: [], //租赁合同的商铺
          parkList: [], //代运营合同的停车场
          adList: [], //广告合同的广告
          areaList: [], //临时场地的区域
          equipmentTree: [], //支出合同的设备
          facilityTree: [], //支出合同的设施
        },
      };
    },

    computed: {
      addBtnTxt() {
        if (this.contractCategory == 2) {
          return '添加支出信息';
        } else {
          return this.contractType == 'QTSR' ? '添加经营信息' : '添加租赁信息';
        }
      },
      //支出信息合同总金额
      payAllPrice() {
        let sum = this.leaseList.reduce((prev, item) => {
          prev += Number(item.fundsAmount);
          return prev;
        }, 0);
        return sum;
      },
      //是否可以编辑: 不在流程中 ｜ 补充协议 可编辑
      isEdit() {
        return !this.contractInfo.contractStatus || this.$route.query.isAgreement || this.contractInfo.contractStatus == 3 ? true : false;
      },
    },

    methods: {
      //提交 | 保存
      async submit(type) {
        if (type == 'audit') {
          await askDialog('确认提交？', () => {
            this.saveData(type);
          });
        } else {
          this.saveData(type);
        }
      },

      //数据入库
      async saveData(type) {
        let model = this.$refs.form.validateForm(); //基本信息top
        let fileData = this.$refs.file.saveFn(); //附件信息

        //校验
        if (model === false) {
          return;
        }
        if (fileData === false) {
          return;
        }
        if (this.signList.length == 0) {
          this.$message.warning('请添加签约方！');
          return;
        }
        if (this.leaseList.length == 0) {
          this.$message.warning('请' + this.addBtnTxt);
          return;
        }
        // if (model.contractCategory == 1 && (!this.billAttachment || !this.billAttachment.fileUrl)) {
        //   this.$message.warning('请添加账单！');
        //   return;
        // }

        // 账单信息
        model.billAttachment = this.billAttachment;

        //基本信息中的以下字段放在contractRentInfo字段中进行保存
        model.contractRentInfo = {};
        model.contractRentInfo.leaserShopName = model.leaserShopName;
        model.contractRentInfo.ifMainStore = model.ifMainStore;
        model.contractRentInfo.industryType = model.industryType;
        model.contractRentInfo.operateBrand = model.operateBrand;

        //签约方
        model.partnerList = this.signList;

        if (this.contractCategory == 1) {
          model.fundsPlanList = null;
          model.rentCycleList = this.leaseList; //收入合同的租赁信息
          model.billList = this.billList; //账单信息
        } else if (this.contractCategory == 2) {
          model.billAttachment = null;
          model.billList = null;
          model.contractTotalAmount = this.payAllPrice;
          model.fundsPlanList = this.leaseList; //支出合同的支出信息
        }

        //附件信息
        for (let i in fileData) {
          model[i] = fileData[i];
        }

        let res = {};
        //isAgreement 代表补充协议
        if (this.$route.query.isAgreement) {
          model.linkedContract = this.$route.query.contractKey;
          model.primaryKey = '';
          model.classification = 'supplement';
          res = await apiAddContract(model);
        } else {
          model.classification = this.contractInfo.classification ? this.contractInfo.classification : 'master';
          if (this.contractInfo.primaryKey) {
            model.contractRentInfo.primaryKey = this.contractInfo.contractRentInfo.primaryKey;
            res = await apiUpdateContract(model);
          } else {
            res = await apiAddContract(model);
          }
        }

        requestTips(res, () => {
          if (type == 'audit') {
            this.submitFn(res.key);
          } else {
            if (this.$route.query.isAgreement) {
              this.saveCb(res.key);
            } else {
              if (this.contractInfo.primaryKey) {
                this.getInfo();
              } else {
                this.saveCb(res.key);
              }
            }
          }
        });
      },

      //提审方法  isAgreement | contractInfo.classification == 'supplement' 代表是补充协议
      async submitFn(key) {
        let contractKey = key || this.contractInfo.contractKey;
        let param = {
          businessKey: contractKey, //合同key
          userPrimaryKey: this.userInfo.key,
          projectKey: this.relevanceParam.projectKey,
          type: '合同', //合同,账单,付款,合同终止
          typeKey: this.$route.query.isAgreement || this.contractInfo.classification == 'supplement' ? 'contractSupplement' : 'contractSubmit',
        };
        let res = await apiCreateAudit(param);
        requestTips(res, async () => {
          let alterRouteParam = { contractKey: contractKey, processWorkId: res.key };
          if (this.$route.query.isAgreement) alterRouteParam.isAgreement = '';
          this.$router.replace({
            query: merge(this.$route.query, alterRouteParam),
          });
          setTimeout(() => {
            window.location.reload(); //reload的原因是： 提审后更新路由的processWorkId参数 要展示审批信息的tab
          }, 500);
        });
      },

      //保存后的回调
      saveCb(contractKey) {
        let param = { contractKey: contractKey };
        if (this.$route.query.isAgreement) param.isAgreement = '';
        this.getInfo(contractKey);
        this.$router.replace({
          query: merge(this.$route.query, param),
        });
      },

      //添加租赁信息 | 签约方
      addTableItem(type) {
        let model = this.$refs.form.validateForm();
        if (model === false) {
          this.$message.warning('请先完善基本信息!');
          return;
        }
        this.setRelevanceParam(model.projectKey, model.contractBeginDate, model.contractEndDate);
        let refName = type == 'lease' ? 'infoTableItem' : 'signTable';
        this.$refs[refName].init('add');
      },

      //新增 ｜ 编辑 (租赁信息 , 签约方)
      confirmAddItem(item, type) {
        // 重新更新租赁信息后，需要重置账单
        if (type == 'lease') {
          this.billList = [];
          this.billAttachment = {
            fileUrl: '',
            fileId: '',
            fileDesc: '',
          };
        }

        let row = this.lodash.cloneDeep(item);
        let listName = type == 'lease' ? 'leaseList' : 'signList';
        if (row.guid) {
          this[listName] = this[listName].map(item => {
            return item.guid == row.guid ? row : item;
          });
          return;
        }
        row.guid = guid();
        this[listName].push(row);
      },

      //删除租赁信息 和 签约方
      deleteItem(index, type) {
        let listName = type == 'lease' ? 'leaseList' : 'signList';
        this[listName].splice(index, 1);
      },

      //基本信息的字段初始化 不是租赁合同和代运营合同的删除字段
      initBaseInfoFiled() {
        if (this.contractType != 'ZL') {
          for (var i = 0; i < this.addContractFiledList.length; i++) {
            let item = this.addContractFiledList[i];
            if (item.bindFieldName == 'leaserShopName' || item.bindFieldName == 'ifMainStore' || item.bindFieldName == 'operateBrand') {
              this.addContractFiledList.splice(i, 1);
              i = i - 1;
            }
          }
        }
      },

      //下载账单模板
      downBillTemplate() {
        if (this.leaseList.length == 0) {
          this.$message.warning('请' + this.addBtnTxt);
          return;
        }
        apiAnalysisDownload({ assetsRentCycleList: this.leaseList });
      },

      //上传账单成功
      handleSuccess(file) {
        console.log(file);
        let num = file.data.rows[0].originalName.lastIndexOf('_');
        let len = file.data.rows[0].originalName.length;
        let cutFileName = file.data.rows[0].originalName.substring(num + 1, len);
        this.billFileName = cutFileName;
        this.getAnalysisFile(file.data.rows[0].url, cutFileName, file.data.rows[0].key);
      },

      //上传账单成功解析
      async getAnalysisFile(url, name, key) {
        let res = await apiAnalysisFile({
          fileUrl: url,
          assetsRentCycleList: this.leaseList,
        });
        this.billList = res.list || [];
        this.billAttachment = {
          fileUrl: url,
          fileId: key,
          fileDesc: name,
        };
      },

      //表单事件
      selectChange(data) {
        // 判断时间
        if (data.filedName == 'contractBeginDate' || data.filedName == 'contractEndDate') {
          let timestamp = data.model.contractEndDate - data.model.contractBeginDate;
          if (timestamp < 0) {
            if (data.filedName == 'contractEndDate') {
              this.$message.warning('合同结束时间应大于合同开始时间');
              data.model.contractEndDate = '';
            }
            if (data.filedName == 'contractBeginDate' && data.model.contractEndDate) {
              this.$message.warning('合同结束时间应大于合同开始时间');
              data.model.contractEndDate = '';
            }
          }
          if (data.model.contractBeginDate && data.model.contractEndDate) {
            this.contractType == 'ZL' && this.getShopList(data.model.projectKey, data.model.contractBeginDate, data.model.contractEndDate);
            this.contractType == 'TCCYY' && this.getParkList(data.model.projectKey, data.model.contractBeginDate, data.model.contractEndDate);
            this.contractType == 'GGZL' && this.getAdList(data.model.projectKey, data.model.contractBeginDate, data.model.contractEndDate);
          }
          this.setRelevanceParam(data.model.projectKey, data.model.contractBeginDate, data.model.contractEndDate);
        }
        //获取品牌
        if (data.filedName == 'industryType') {
          let parentId = '';
          data.formItem.optionList.forEach(filed => {
            if (filed.primaryKey == data.filedVal) {
              parentId = filed.parentId;
            }
          });
          data.cb('operateBrand', '');
          this.getOperateBrand(parentId);
        }
        //改变项目
        if (data.filedName == 'projectKey') {
          this.leaseList = [];
          this.setRelevanceParam(data.model.projectKey, data.model.contractBeginDate, data.model.contractEndDate);
          this.getOptionByProject(data.model.projectKey, data.model.contractBeginDate, data.model.contractEndDate);
        }
      },

      //改变项目 | 详情 时触发 请求多个数据源
      getOptionByProject(projectKey, contractBeginDate, contractEndDate) {
        this.contractType == 'ZL' && this.getShopList(projectKey, contractBeginDate, contractEndDate);
        this.contractType == 'TCCYY' && this.getParkList(projectKey, contractBeginDate, contractEndDate);
        this.contractType == 'GGZL' && this.getAdList(projectKey, contractBeginDate, contractEndDate);
        this.contractType == 'LSCD' && this.getAreaList(projectKey);
        this.contractCategory == 2 && this.getEquimentTree(projectKey);
        this.contractCategory == 2 && this.getFacilityTree(projectKey);
      },

      //设置项目key 合同时间 给子组件
      setRelevanceParam(projectKey, contractBeginDate, contractEndDate) {
        this.relevanceParam = {
          projectKey: projectKey,
          contractBeginDate: contractBeginDate,
          contractEndDate: contractEndDate,
        };
      },

      //选择商铺资产时，判断是否传isuse
      getIsuse() {
        let isUse = null;
        if (this.$route.query.isAgreement) {
          //isAgreement代表补充协议
          isUse = 1;
        } else {
          isUse = !this.contractInfo.contractStatus || this.contractInfo.contractStatus == 3 ? 1 : null;
        }
        return isUse;
      },

      //租赁合同 代运营合同 营销成本的回显
      costBackVal(rent) {
        if (this.contractType == 'ZL' || this.contractType == 'TCCYY') {
          let deepCloneCostList = this.lodash.cloneDeep(rent.discountRentList);
          let noRepetCostList = this.lodash.uniqBy(deepCloneCostList, 'rentFreeItem'); //事项补贴去重
          noRepetCostList.forEach(item => (item.amount = 0));
          rent.discountRentList.forEach(oldCost => {
            noRepetCostList.forEach(newCost => {
              if (oldCost.rentFreeItem == newCost.rentFreeItem) {
                newCost.amount += Number(oldCost.amount);
              }
            });
          });
          noRepetCostList.forEach(item => {
            rent[item.rentFreeItem] = item.amount;
          });
        }
      },

      //支出合同 设备设施的回显
      facilityBackVal(rent) {
        rent.assetName = '';
        rent.stationName = '';
        if (!rent.assetList || rent.assetList.length == 0) return;
        rent.assetList.forEach(item => {
          rent.assetName += item.assetName + ',';
        });
        rent.stationList.forEach(item => {
          rent.stationName += item.assetName + ',';
        });
        rent.assetName = rent.assetName.substr(0, rent.assetName.length - 1);
        rent.stationName = rent.stationName.substr(0, rent.stationName.length - 1);
      },

      //禁止字段编辑
      banFieldEdit() {
        this.addContractFiledList.forEach(item => {
          item.isReadOnly = true;
          item.isRequired = false;
          if (item.type == 'select' || item.type == 'date' || item.type == 'radio' || item.type == 'checkbox') {
            item.isDisabled = true;
          }
        });
      },

      //详情
      async getInfo(key) {
        let res = await apiContractInfo({ primaryKey: key || this.$route.query.contractKey });
        this.getOptionByProject(res.projectKey, res.contractBeginDate, res.contractEndDate);
        //收入合同相关
        if (this.contractCategory == 1) {
          res.rentCycleList.forEach(rent => {
            rent.guid = guid();
            if (rent.discountRentList && rent.discountRentList.length > 0) this.costBackVal(rent);
          });
        }
        //支出合同相关
        if (this.contractCategory == 2) {
          res.fundsPlanList.forEach(rent => {
            rent.guid = guid();
            this.facilityBackVal(rent);
          });
        }

        res.partnerList.forEach(item => {
          item.guid = guid();
        });

        //基本信息中的以下字段在contractRentInfo保存 摘出来
        res.contractRentInfo = res.contractRentInfo ? res.contractRentInfo : {};
        res.leaserShopName = res.contractRentInfo.leaserShopName;
        res.ifMainStore = res.contractRentInfo.ifMainStore;
        res.industryType = res.contractRentInfo.industryType;
        res.operateBrand = res.contractRentInfo.operateBrand;

        //设置项目key 合同时间 给子组件
        this.setRelevanceParam(res.projectKey, res.contractBeginDate, res.contractEndDate);

        // 账单文件 非补充协议时赋值
        if (res.billAttachment && !this.$route.query.isAgreement) {
          this.billAttachment = res.billAttachment;
        }

        this.signList = res.partnerList || [];
        this.leaseList = this.contractCategory == 1 ? res.rentCycleList || [] : res.fundsPlanList || [];
        this.contractInfo = res;
        this.$refs.form.initModel();
        this.getListByMapBizId(res.industryType);
        setFiledVal(this.addContractFiledList, res);

        // 获取账单信息
        let resBill = await apiContractBillBaseList({
          contractKey: key || this.$route.query.contractKey,
        });

        this.billList = resBill.rows || [];

        //如果不是草稿 字段不允许编辑
        if (!this.isEdit) {
          this.banFieldEdit();
        }
      },

      //商铺数据源
      async getShopList(projectKey, startDate, endDate) {
        if (!projectKey || !startDate || !endDate) return;
        let res = await apiShopList({
          projectKey: projectKey,
          startDate: startDate,
          endDate: endDate,
          isUse: this.getIsuse(),
        });
        res.rows.forEach(item => (item.ifCanChecked = true));
        this.optionMap.shopList = res.rows || [];
      },

      //停车场数据源
      async getParkList(projectKey, startDate, endDate) {
        if (!projectKey || !startDate || !endDate) return;
        let res = await apiParkList({
          projectKey: projectKey,
          startDate: startDate,
          endDate: endDate,
        });
        res.rows.forEach(item => (item.ifCanChecked = true));
        this.optionMap.parkList = res.rows || [];
      },

      //广告数据源
      async getAdList(projectKey, startDate, endDate) {
        if (!projectKey || !startDate || !endDate) return;
        let res = await apiAdvertList({
          projectKey: projectKey,
          startDate: startDate,
          endDate: endDate,
        });
        res.rows.forEach(item => (item.ifCanChecked = true));
        this.optionMap.adList = res.rows || [];
      },

      //临时场地合同的区域数据源
      async getAreaList(projectKey) {
        if (!projectKey) return;
        let res = await apiAreaList({
          projectKey: projectKey,
        });
        this.optionMap.areaList = res.rows || [];
      },

      //设备树
      async getEquimentTree(projectKey) {
        if (!projectKey) return;
        let res = await apiEquipmentTree({
          projectKey: projectKey,
        });
        this.optionMap.equipmentTree = res.treeList || [];
      },

      //设施树
      async getFacilityTree(projectKey) {
        if (!projectKey) return;
        let res = await apiFacilityTree({
          projectKey: projectKey,
        });
        this.optionMap.facilityTree = res.treeList || [];
      },

      //常量
      async getConstant() {
        let res = await apiPactConstant();
        this.subsidyTypeList = res.discountType || [];
        this.paymentMethodList = res.paymentMethod || [];
      },

      //合同类型
      async getOptionList() {
        let res = await apiDictMoreList({ dictTypeList: ['contractType'] });
        this.dictoryList = res.rows || [];
        let contractTypeObj = res.rows.find(item => item.dictType == 'contractType');
        this.addContractFiledList.forEach(item => {
          if (item.bindFieldName == 'contractType') {
            item.optionList = contractTypeObj.dictList || [];
            this.$refs.form.setFiledSource('contractType', this.$route.query.contractType);
          }
        });
      },

      //项目信息
      async getProjectList() {
        let res = await apiProjectList();
        this.addContractFiledList.forEach(item => {
          if (item.bindFieldName == 'projectKey') {
            item.optionList = res.rows || [];
          }
        });
      },

      //业态/行业类型 industryTypeId：经营品牌的key
      async getListByMapBizId(industryTypeId) {
        let res = await listByMapBizId({
          bizId: 'commercial_rent_main_data',
          catalogTypeList: ['business_type_child'],
          mapBizId: this.contractInfo.enterpriseid || this.enterpriseid, //企业id
        });
        this.addContractFiledList.forEach(ele => {
          if (ele.bindFieldName == 'industryType') {
            ele.optionList = res.rows;
          }
        });
        let parentId = '';
        res.rows.forEach(filed => {
          if (filed.primaryKey == industryTypeId) {
            parentId = filed.parentId;
          }
        });
        //反显经营品牌
        if (industryTypeId) {
          this.getOperateBrand(parentId);
        }
      },

      //获取品牌 - 常量；
      async getOperateBrand(parentId) {
        let res = await categoryList({
          parentId: parentId,
          catalogTypeList: ['brand_child'],
        });
        this.addContractFiledList.forEach(ele => {
          if (ele.bindFieldName == 'operateBrand') {
            ele.optionList = res.rows;
          }
        });
      },
      //下载
      uploadLoad(url) {
        let a = document.createElement('a');
        a.style.display = 'none';
        a.href = url;
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
      },
    },

    created() {
      this.initBaseInfoFiled();
      this.getConstant();
      this.getOptionList();
      this.getListByMapBizId();
      this.getProjectList();
      this.$route.query.contractKey && this.getInfo();
    },

    components: { formCommon, infoTable, infoTableItem, infoPayTable, billTable, infoPayTableItem, contractFile, signTable, uploadFile },
  };
</script>

<style lang="scss" scoped>
  ::v-deep .el-form .el-form-item__label {
    padding-left: 0;
  }
</style>
